package base.thread.threadCommunication.guanChengFa;

/**
 * @Author: my_code
 * @Create: 2020-12-09 13:07
 */
public class Consumer implements Runnable{
    SynContainer container;

    public Consumer(SynContainer container) {
        this.container = container;
    }

    @Override
    public void run() {
        while (true){
            Cake pop =  container.pop();
            System.out.println("消费者购买了："+pop.getId()+"号蛋糕");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }

    }
}
